//Unittest1 getCost
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>



int main(int argc, char const *argv[])
{
	
//for printing later
char* cards[] = {"curse", "estate", "duchy", "province", "copper", "silver", "gold", "adventurer", "council room", "feast", "gardens", "mine", "remodel", "smithy", "village", "baron", "great hall", "minion", "steward", "tribute", "ambassador", "cutpurse", "embargo", "outpost", "salvager", "sea hag", "treasure map", "no card"};
int rand_card;
int cost;
int i;

for(i = 0; i < 1000; i++){
	//generate random cards
	rand_card = rand() % 28;
	//get costs
	cost = getCost(rand_card);
	//compare costs
	if(rand_card == 0 || rand_card == 4){
		if(cost == 0){
			printf("Pass: %s costs 0\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 0, assigned %d\n", cards[rand_card], cost);
		}
	}else if(rand_card == 1 || rand_card == 22){
		if(cost == 2){
			printf("Pass: %s costs 2\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 2, assigned %d\n", cards[rand_card], cost);
		}
	} else if(rand_card == 5 || rand_card == 14 || rand_card == 16 || rand_card == 18 || rand_card == 20){
		if(cost == 3){
			printf("Pass: %s costs 3\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 3, assigned %d\n", cards[rand_card], cost);
		}
	} else if(rand_card == 9 || rand_card == 10 || rand_card == 12 || rand_card == 13 || rand_card == 15 || rand_card == 21 || rand_card == 24 || rand_card == 25 || rand_card == 26){
		if(cost == 4){
			printf("Pass: %s costs 4\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 4, assigned %d\n", cards[rand_card], cost);
		}
	}else if(rand_card == 2 || rand_card == 8 || rand_card == 11 || rand_card == 17 || rand_card == 19 || rand_card == 23){
		if(cost == 5){
			printf("Pass: %s costs 5\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 5, assigned %d\n", cards[rand_card], cost);
		}
	}else if(rand_card == 6 || rand_card == 7){
		if(cost == 6){
			printf("Pass: %s costs 6\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 6, assigned %d\n", cards[rand_card], cost);
		}
	}else if(rand_card == 3){
		if(cost == 8){
			printf("Pass: %s costs 8\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs 8, assigned %d\n", cards[rand_card], cost);
		}
	}else if(rand_card == 27){
		if(cost == -1){
			printf("Pass: %s costs -1\n", cards[rand_card]);
		} else {
			printf("Fail: %s costs -1, assigned %d\n", cards[rand_card], cost);
		}
	}else {
		printf("Random card %d not found\n", rand_card);
	}
}

	return 0;
}